package com.yb.xczx.cloud.auth.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.Instant;
import java.util.Set;
import com.yb.xczx.cloud.auth.oauth2.handler.mybatis.*;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.security.oauth2.core.AuthorizationGrantType;
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
import org.springframework.security.oauth2.server.authorization.settings.ClientSettings;
import org.springframework.security.oauth2.server.authorization.settings.TokenSettings;

/**
 * <p>
 * 
 * </p>
 *
 * @author 姚兵
 * @since 2023-05-17
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName(value = "oauth2_registered_client",autoResultMap = true)
@ApiModel(value = "Oauth2RegisteredClient对象", description = "")
public class Oauth2RegisteredClient {

    @TableId("id")
    private String id;

    @TableField("client_id")
    private String clientId;

    @TableField("client_id_issued_at")
    private Instant clientIdIssuedAt;

    @TableField("client_secret")
    private String clientSecret;

    @TableField("client_secret_expires_at")
    private Instant clientSecretExpiresAt;

    @TableField("client_name")
    private String clientName;

    @TableField(value = "client_authentication_methods",typeHandler = XczxClientAuthenticationMethodSetTypeHandler.class)
    private Set<ClientAuthenticationMethod> clientAuthenticationMethods;

    @TableField(value = "authorization_grant_types",typeHandler = XczxAuthorizationGrantTypeSetTypeHandler.class)
    private Set<AuthorizationGrantType> authorizationGrantTypes;

    @TableField(value = "redirect_uris",typeHandler = XczxStringSetTypeHandler.class)
    private Set<String> redirectUris;

    @TableField(value = "scopes",typeHandler = XczxStringSetTypeHandler.class)
    private Set<String> scopes;

    @TableField(value = "client_settings",typeHandler = ClientSettingsTypeHandler.class)
    private ClientSettings clientSettings;

    @TableField(value = "token_settings",typeHandler = TokenSettingsTypeHandler.class)
    private TokenSettings tokenSettings;


}
